<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>vue学习</title>
    <script src="./js/vue.js"></script>
  </head>
  <body>
    <div id="app">
      <ul>
        <li v-for="item in users" :key="item.id">{{item.name}}</li>
      </ul>
    </div>
    <script>
      const app = Vue.createApp({
        data() {
          return {
            // 要展示的用户列表数据，进行初始化
            users: []
          }
        },
        async created() {
          // let res = await fetch('/mock/user.json').then((ret) => ret.json())
          // this.users = res.data
          let res = await (await fetch('/mock/user.json')).json()
          this.users = res.data
        }
      })
      app.mount('#app')
    </script>
  </body>
</html>
